<!DOCTYPE html>
<html lang="en">

<!-- Head tag -->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="一份耕耘，一份收获">
    <meta name="keyword"  content="朗月清风,韩亚军">
    <link rel="shortcut icon" href="/img/favicon.ico">
    <!-- Place this tag in your head or just before your close body tag. -->
    <script async defer src="https://buttons.github.io/buttons.js"></script>
    <title>
        
          基于Travis CI实现 Gitbook在 Github 和 Coding 的同步部署 - 朗月清风
        
    </title>

    <link rel="canonical" href="https://hanyajun.com/devops/gitbook_coding_ci/">

    <!-- Bootstrap Core CSS -->
    <link rel="stylesheet" href="/css/bootstrap.min.css">

    <!-- Custom CSS --> 
    <link rel="stylesheet" href="/css/beantech.min.css">

    <link rel="stylesheet" href="/css/donate.css">
    
    <!-- Pygments Highlight CSS -->
    <link rel="stylesheet" href="/css/highlight.css">

    <link rel="stylesheet" href="/css/widget.css">

    <link rel="stylesheet" href="/css/rocket.css">

    <link rel="stylesheet" href="/css/signature.css">

    <link rel="stylesheet" href="/css/toc.css">

    <!-- Custom Fonts -->
    <!-- <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"> -->
    <!-- Hux change font-awesome CDN to qiniu -->
    <link href="https://cdn.staticfile.org/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">


    <!-- Hux Delete, sad but pending in China
    <link href='http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/
    css'>
    -->


    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- ga & ba script hoook -->
    <script></script>

    <!--不蒜子-->
    <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

    
<link rel="stylesheet" href="\assets\css\APlayer.min.css" class="aplayer-style-marker">
<script src="\assets\js\APlayer.min.js" class="aplayer-script-marker"></script>
<script src="\assets\js\Meting.min.js" class="meting-script-marker"></script>
</head>


<!-- hack iOS CSS :active style -->
<body ontouchstart="">
	<!-- Modified by Yu-Hsuan Yen -->
<!-- Post Header -->
<style type="text/css">
    header.intro-header{
        
            background-image: url('http://cdn.hanyajun.com/20190518_010025_20190321.jpg')
            /*post*/
        
    }
    
</style>

<header class="intro-header" >
    <!-- Signature -->
    <div id="signature">
        <div class="container">
            <div class="row">
                <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                
                    <div class="post-heading">
                        <div class="tags">
                            
                              <a class="tag" href="/tags/#devops" title="devops">devops</a>
                            
                        </div>
                        <h1>基于Travis CI实现 Gitbook在 Github 和 Coding 的同步部署</h1>
                        <h2 class="subheading">Travis CI实现gitbook同步部署github和coding</h2>

                        <!--文章访问量统计-->
                        
                            <span id="busuanzi_container_page_pv">本文已被阅读过<span id="busuanzi_value_page_pv"></span>次</span>
                        
                        <!--文章访问量统计-->

                        <span class="meta">
                            Posted by 韩亚军 on
                            2019-05-18
                        </span>
                    </div>
                


                </div>
            </div>
        </div>
    </div>
</header>

	
    <!-- Navigation -->
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">韩亚军</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <!-- Known Issue, found by Hux:
            <nav>'s height woule be hold on by its content.
            so, when navbar scale out, the <nav> will cover tags.
            also mask any touch event of tags, unfortunately.
        -->
        <div id="huxblog_navbar">
            <div class="navbar-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="/">Home</a>
                    </li>

                    
                        <li>
                            <a href="/about/" >About</a>
                        </li>
                    
                        <li>
                            <a href="/archives/" >Archives</a>
                        </li>
                    
                        <li>
                            <a href="/tags/" >Tags</a>
                        </li>
                    

                    <!-- 

                        
                    

                        
                        <li>
                            <a href="/about/">About</a>
                        </li>
                        
                    

                        
                        <li>
                            <a href="/tags/">Tags</a>
                        </li>
                        
                    

                        
                        <li>
                            <a href="/archive/">Archives</a>
                        </li>
                        
                     -->
                    
                </ul>
            </div>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>
<script>
    // Drop Bootstarp low-performance Navbar
    // Use customize navbar with high-quality material design animation
    // in high-perf jank-free CSS3 implementation
    var $body   = document.body;
    var $toggle = document.querySelector('.navbar-toggle');
    var $navbar = document.querySelector('#huxblog_navbar');
    var $collapse = document.querySelector('.navbar-collapse');

    $toggle.addEventListener('click', handleMagic)
    function handleMagic(e){
        if ($navbar.className.indexOf('in') > 0) {
        // CLOSE
            $navbar.className = " ";
            // wait until animation end.
            setTimeout(function(){
                // prevent frequently toggle
                if($navbar.className.indexOf('in') < 0) {
                    $collapse.style.height = "0px"
                }
            },400)
        }else{
        // OPEN
            $collapse.style.height = "auto"
            $navbar.className += " in";
        }
    }
</script>


    <!-- Main Content -->
    <!-- Modify by Yu-Hsuan Yen -->

<!-- Post Content -->
<article>
    <div class="container">
        <div class="row">

            <!-- Post Container -->
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                post-container">

                <h3 id="前言">前言</h3>
<p>最近发现自己的<a href="https://hanyajun.com">博客</a>在使用vpn的情况下打开很慢，百度站点也抓取失败，于是将自己的博客借助hexo-deploy 插件很容易同步部署到了coding上。只需要在你的hexo配置文件_config.yml的deploy配上coding的coding page项目url(注意将ssh key 设置好)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">- type: git</span><br><span class="line">  repository: </span><br><span class="line">    - git@github.com:Han-Ya-Jun/Han-Ya-Jun.github.io.git</span><br><span class="line">    - git@git.dev.tencent.com:hanyajun0123/hanyajun0123.git</span><br><span class="line">  branch: master</span><br><span class="line">  message: update</span><br><span class="line">- type: baidu_url_submitter</span><br></pre></td></tr></table></figure>
<p><img src="http://cdn.hanyajun.com/20190517_223401_coding1.png" alt=""></p>
<p>配置后于是在阿里云的域名解析上新增两条CNAME记录指向 <a href="http://hanyajun0123.coding.me" target="_blank" rel="noopener">hanyajun0123.coding.me</a>，选择默认解析，原来github的解析换成国外的dns解析路线，这样国内的就指向coding，<a href="http://xn--github-vi6j56qdnff53a752c.io" target="_blank" rel="noopener">国外的指向github.io</a><br>
<img src="http://cdn.hanyajun.com/20190517_223401_coding.png" alt=""><br>
访问的时候出现了下面的这种异常（您的链接不是私密链接）<br>
<img src="http://cdn.hanyajun.com/20190517_223403_coding3.png" alt=""><br>
看了下coding的证书申请情况也是一直失败<br>
<img src="http://cdn.hanyajun.com/20190517_223403_coding4.png" alt=""><br>
后来查了下资料发现得先暂停掉原先指向github.io的解析，这个会对与coding page进行校验。后来停掉再次申请ssl证书就成功了，本来以为完美解决了，谁知自己部署在github page的gitbook的项目访问不了，翻墙之后就可以访问了，这个很好解释，不翻墙就解析到了coding上。于是自己又琢磨了下如何基于travis ci实现gitbook在github和coding的自动化ci。如果之前没有尝试过使用travis ci来部署gitbo的可以参考下我之前写的一篇博客<a href="https://hanyajun.com/devops/travis-ci/">《如何使用travis-ci自动化构建部署GitHub Pages（gitbook)》</a></p>
<h3 id="ci流程">CI流程</h3>
<p><img src="http://cdn.hanyajun.com/20190518_002929_gitbook_ci.jpg" alt=""></p>
<h3 id="获取coding访问令牌">获取coding访问令牌</h3>
<p><img src="http://cdn.hanyajun.com/20190518_003850_token_coding.png" alt=""></p>
<h3 id="travis添加coding-token环境变量">travis添加coding token环境变量</h3>
<p>在Travis上原来github部署ci的gitbook项目里面添加访问coding token。<br>
<img src="http://cdn.hanyajun.com/20190518_004210_coding_token.png" alt=""></p>
<h3 id="修改travisyaml-文件">修改.travis.yaml 文件</h3>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">after_script:</span><br><span class="line">   - cd ./_book</span><br><span class="line">   - git init</span><br><span class="line">   - git config user.name &quot;*****&quot; </span><br><span class="line">   - git config user.email &quot;******&quot;</span><br><span class="line">   - git add .</span><br><span class="line">   - git commit -m &quot;Update Gitbook By TravisCI With Build $TRAVIS_BUILD_NUMBER&quot;</span><br><span class="line">   - git push --force --quiet &quot;https://hanyajun0123:$&#123;CODING_TOKEN&#125;@$&#123;CO_REF&#125;&quot; master:master</span><br><span class="line">   - git tag v0.0.$TRAVIS_BUILD_NUMBER -a -m &quot;Auto Taged By TravisCI With Build $TRAVIS_BUILD_NUMBER&quot;</span><br><span class="line">   - git push --quiet &quot;https://hanyajun0123:$&#123;CODING_TOKEN&#125;@$&#123;CO_REF&#125;&quot; master:master --tags</span><br><span class="line"></span><br><span class="line"># git@git.dev.tencent.com:hanyajun0123/coding_basis_review.git</span><br><span class="line">env:</span><br><span class="line"> global:</span><br><span class="line">   # Coding Pages</span><br><span class="line">   - CO_REF: git.dev.tencent.com/hanyajun0123/coding_basis_review.git</span><br></pre></td></tr></table></figure>
<p><a href="https://github.com/Han-Ya-Jun/coding_basis_review/blob/master/.travis.yml" target="_blank" rel="noopener">完整.travis.yaml文件</a></p>
<h3 id="触发ci">触发ci</h3>
<p>修改本地gitbook项目，推送到github上去，就可以粗发ci了。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br></pre></td><td class="code"><pre><span class="line">Creating a brand new local repo from scratch in dir /tmp/d20190517-7047-qvpbfn/work...</span><br><span class="line">dpl.2</span><br><span class="line">Preparing deploy</span><br><span class="line">dpl.3</span><br><span class="line">Deploying application</span><br><span class="line">Initialized empty Git repository in /tmp/d20190517-7047-qvpbfn/work/.git/</span><br><span class="line">Repo created successfully</span><br><span class="line">Switched to a new branch &apos;gh-pages&apos;</span><br><span class="line">An orphan branch gh-pages created successfully</span><br><span class="line">cd -</span><br><span class="line">cd /tmp/d20190517-7047-qvpbfn/work</span><br><span class="line">Copying /home/travis/build/Han-Ya-Jun/coding_basis_review/_book contents to /tmp/d20190517-7047-qvpbfn/work (workdir: /tmp/d20190517-7047-qvpbfn/work)...</span><br><span class="line">Configuring git committer to be Deployment Bot (from Travis CI) &lt;deploy@travis-ci.org&gt; (workdir: /tmp/d20190517-7047-qvpbfn/work)</span><br><span class="line">Preparing to deploy gh-pages branch to gh-pages (workdir: /tmp/d20190517-7047-qvpbfn/work)</span><br><span class="line">commit 76413d48b1f036c4b9c9b4e3fbad583fa24aa87a</span><br><span class="line">Author: Deployment Bot (from Travis CI) &lt;deploy@travis-ci.org&gt;</span><br><span class="line">Date:   Fri May 17 01:15:08 2019 +0800</span><br><span class="line">    Deploy Han-Ya-Jun/coding_basis_review to github.com/Han-Ya-Jun/coding_basis_review.git:gh-pages</span><br><span class="line"> .travis.yml                                        |  49 ++</span><br><span class="line"> generation                                         |   0</span><br><span class="line"> gitbook/fonts/fontawesome/FontAwesome.otf          | Bin 0 -&gt; 124988 bytes</span><br><span class="line"> gitbook/fonts/fontawesome/fontawesome-webfont.eot  | Bin 0 -&gt; 76518 bytes</span><br><span class="line"> gitbook/fonts/fontawesome/fontawesome-webfont.svg  | 685 +++++++++++++++++++++</span><br><span class="line"> gitbook/fonts/fontawesome/fontawesome-webfont.ttf  | Bin 0 -&gt; 152796 bytes</span><br><span class="line"> gitbook/fonts/fontawesome/fontawesome-webfont.woff | Bin 0 -&gt; 90412 bytes</span><br><span class="line"> .../fonts/fontawesome/fontawesome-webfont.woff2    | Bin 0 -&gt; 71896 bytes</span><br><span class="line"> gitbook/gitbook-plugin-3-ba/plugin.js              |  20 +</span><br><span class="line"> .../gitbook-plugin-back-to-top-button/plugin.css   |  55 ++</span><br><span class="line"> ...</span><br><span class="line"> 51 files changed, 6434 insertions(+)</span><br><span class="line">Doing the git push (workdir: /tmp/d20190517-7047-qvpbfn/work)...</span><br><span class="line">On branch gh-pages</span><br><span class="line">nothing to commit, working tree clean</span><br><span class="line">cd -</span><br><span class="line">App has been pushed</span><br><span class="line">after_script.1</span><br><span class="line">0.01s$ cd ./_book</span><br><span class="line">after_script.2</span><br><span class="line">0.01s$ git init</span><br><span class="line">Initialized empty Git repository in /home/travis/build/Han-Ya-Jun/coding_basis_review/_book/.git/</span><br><span class="line">after_script.3</span><br><span class="line">0.01s$ git config user.name &quot;hanyajun0123&quot;</span><br><span class="line">after_script.4</span><br><span class="line">0.01s$ git config user.email &quot;1581532052@qq.com&quot;</span><br><span class="line">after_script.5</span><br><span class="line">0.05s$ git add .</span><br><span class="line">after_script.6</span><br><span class="line">0.02s$ git commit -m &quot;Update Gitbook By TravisCI With Build $TRAVIS_BUILD_NUMBER&quot;</span><br><span class="line">[master (root-commit) 1c86337] Update Gitbook By TravisCI With Build 10</span><br><span class="line"> 51 files changed, 6434 insertions(+)</span><br><span class="line"> create mode 100644 .travis.yml</span><br><span class="line"> create mode 100644 generation</span><br><span class="line"> create mode 100644 gitbook/fonts/fontawesome/FontAwesome.otf</span><br><span class="line"> create mode 100644 gitbook/fonts/fontawesome/fontawesome-webfont.eot</span><br><span class="line"> create mode 100644 gitbook/fonts/fontawesome/fontawesome-webfont.svg</span><br><span class="line"> create mode 100644 gitbook/fonts/fontawesome/fontawesome-webfont.ttf</span><br><span class="line"> create mode 100644 gitbook/fonts/fontawesome/fontawesome-webfont.woff</span><br><span class="line"> create mode 100644 gitbook/fonts/fontawesome/fontawesome-webfont.woff2</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-3-ba/plugin.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-back-to-top-button/plugin.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-back-to-top-button/plugin.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-disqus/plugin.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-disqus/plugin.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-donate/plugin.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-donate/plugin.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-editlink/plugin.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-fontsettings/fontsettings.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-fontsettings/website.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-ga/plugin.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-github-buttons/plugin.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-github-buttons/plugin.js.map</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-github/plugin.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-image-captions/image-captions.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-page-toc-button/plugin.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-page-toc-button/plugin.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-prism/prism-coy.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-prism/prism-dark.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-prism/prism-funky.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-prism/prism-okaidia.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-prism/prism-solarizedlight.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-prism/prism-tomorrow.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-prism/prism-twilight.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-prism/prism.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-search-plus/jquery.mark.min.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-search-plus/search.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-search-plus/search.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-sharing/buttons.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-splitter/splitter.css</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-splitter/splitter.js</span><br><span class="line"> create mode 100644 gitbook/gitbook-plugin-tbfed-pagefooter/footer.css</span><br><span class="line"> create mode 100644 gitbook/gitbook.js</span><br><span class="line"> create mode 100644 gitbook/images/apple-touch-icon-precomposed-152.png</span><br><span class="line"> create mode 100644 gitbook/images/favicon.ico</span><br><span class="line"> create mode 100644 gitbook/style.css</span><br><span class="line"> create mode 100644 gitbook/theme.js</span><br><span class="line"> create mode 100644 index.html</span><br><span class="line"> create mode 100644 network/TCP_IP.html</span><br><span class="line"> create mode 100644 network/summary.html</span><br><span class="line"> create mode 100644 package-lock.json</span><br><span class="line"> create mode 100644 search_plus_index.json</span><br><span class="line"> create mode 100644 sitemap.xml</span><br><span class="line">after_script.7</span><br><span class="line">3.87s$ git push --force --quiet &quot;https://hanyajun0123:$&#123;CODING_TOKEN&#125;@$&#123;CO_REF&#125;&quot; master:master</span><br><span class="line">after_script.8</span><br><span class="line">0.01s$ git tag v0.0.$TRAVIS_BUILD_NUMBER -a -m &quot;Auto Taged By TravisCI With Build $TRAVIS_BUILD_NUMBER&quot;</span><br><span class="line">after_script.9</span><br><span class="line">1.65s$ git push --quiet &quot;https://hanyajun0123:$&#123;CODING_TOKEN&#125;@$&#123;CO_REF&#125;&quot; master:master --tags</span><br><span class="line">Done. Your build exited with 0.</span><br></pre></td></tr></table></figure>

    <div id="aplayer-XYzAwZyj" class="aplayer aplayer-tag-marker meting-tag-marker" data-id="002sun3u2HDgYl" data-server="tencent" data-type="song" data-mode="circulation" data-autoplay="false" data-mutex="false" data-listmaxheight="340px" data-preload="none" data-theme="#ad7a86"></div>
<p><br><br><br></p>
<div><h2 id="推荐文章">推荐文章<span style="font-size:0.45em; color:gray"></span></h2><ul><li><a href="https://hanyajun.com/devops/travis-ci/">如何使用travis-ci自动化构建部署GitHub Pages（gitbook）</a></li><li><a href="https://hanyajun.com/article/github_travis_ci/">github上Go项目使用Travis CI和Docker Hub实现持续集成</a></li><li><a href="https://hanyajun.com/devops/code_pipeline_devops/">go程序基于阿里云CodePipeline的一次devops实践</a></li></ul></div>
                

                <hr>
                <!-- Pager -->
                <ul class="pager">
                    
                        <li class="previous">
                            <a href="/tools/qiniuyun_uoload_tools/" data-toggle="tooltip" data-placement="top" title="七牛云文件上传助手">&larr; Previous Post</a>
                        </li>
                    
                    
                        <li class="next">
                            <a href="/article/github_travis_ci/" data-toggle="tooltip" data-placement="top" title="github上Go项目使用Travis CI和Docker Hub实现持续集成">Next Post &rarr;</a>
                        </li>
                    
                </ul>

                <br>

                <!--打赏-->
                
                    <div class="reward">
                        <div class="reward-button">赏 <span class="reward-code"> 
                            <span class="alipay-code"> <img class="alipay-img" src="http://cdn.hanyajun.com/alipay.jpg"><b>支付宝打赏</b></span> 
                            <span class="wechat-code"> <img class="wechat-img" src="http://cdn.hanyajun.com/wepay.png"><b>微信打赏</b> </span>
                            </span></div>
                        <p class="reward-notice">坚持原创技术分享，您的支持将鼓励我继续创作！</p>
                    </div>
                
                <!--打赏-->

                <br>
                <!--分享-->
                
                    <div class="social-share"  data-wechat-qrcode-helper="" align="center"></div>
                    <!--  css & js -->
                    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/css/share.min.css">
                    <script src="https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/js/social-share.min.js"></script>
                
                <!--分享-->
                <br>                       
                
                <!-- require APlayer -->
                

                <!-- duoshuo Share start -->
                
                <!-- 多说 Share end-->

                <!-- 多说评论框 start -->
                
                <!-- 多说评论框 end -->

                <!-- disqus comment start -->
                
                <!-- disqus comment end -->

                
                    <!-- disqus 评论框 start -->
                    <div class="comment">
                        <div id="lv-container" data-id="city" data-uid="MTAyMC80MzgyNi8yMDM2MQ"></div>
                    </div>
                    <!-- disqus 评论框 end -->
                

            </div>
            
            <!-- Tabe of Content -->
            <!-- Table of Contents -->

  
    <style>
      span.toc-nav-number{
        display: none
      }
    </style>
  
    
      <aside id="sidebar">
        <div id="toc" class="toc-article">
        <strong class="toc-title">Contents</strong>
        
          <ol class="toc-nav"><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#前言"><span class="toc-nav-number">1.</span> <span class="toc-nav-text">&#x524D;&#x8A00;</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#ci流程"><span class="toc-nav-number">2.</span> <span class="toc-nav-text">CI&#x6D41;&#x7A0B;</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#获取coding访问令牌"><span class="toc-nav-number">3.</span> <span class="toc-nav-text">&#x83B7;&#x53D6;coding&#x8BBF;&#x95EE;&#x4EE4;&#x724C;</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#travis添加coding-token环境变量"><span class="toc-nav-number">4.</span> <span class="toc-nav-text">travis&#x6DFB;&#x52A0;coding token&#x73AF;&#x5883;&#x53D8;&#x91CF;</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#修改travisyaml-文件"><span class="toc-nav-number">5.</span> <span class="toc-nav-text">&#x4FEE;&#x6539;.travis.yaml &#x6587;&#x4EF6;</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#触发ci"><span class="toc-nav-number">6.</span> <span class="toc-nav-text">&#x89E6;&#x53D1;ci</span></a></li></ol></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#推荐文章"><span class="toc-nav-number"></span> <span class="toc-nav-text">&#x63A8;&#x8350;&#x6587;&#x7AE0;<span style="font-size:0.45em; color:gray"></span></span></a>
        
        </div>
      </aside>
    

                
            <!-- Sidebar Container -->
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                sidebar-container">

                <!-- Featured Tags -->
                
                <section>
                    <!-- no hr -->
                    <h5><a href="/tags/">FEATURED TAGS</a></h5>
                    <div class="tags">
                       
                          <a class="tag" href="/tags/#devops" title="devops">devops</a>
                        
                    </div>
                </section>
                

                <!-- Friends Blog -->
                
                <hr>
                <h5>FRIENDS</h5>
                <ul class="list-inline">

                    
                        <li><a href="https://blog.csdn.net/hanyajun0123" target="_blank">CSDN Blog 韩亚军</a></li>
                    
                        <li><a href="https://hanyajun.com/golang-notes" target="_blank">golang学习笔记</a></li>
                    
                        <li><a href="https://hanyajun.com/coding_basis_review" target="_blank">编程基础复盘笔记</a></li>
                    
                        <li><a href="https://hanyajun.com/coding-life" target="_blank">程序人生</a></li>
                    
                        <li><a href="http://blog.didispace.com/" target="_blank">程序猿DD</a></li>
                    
                </ul>
                
            </div>
        </div>
    </div>
</article>






    <!-- 来必力City版公共JS代码 start (一个网页只需插入一次) -->
    <script type="text/javascript">
       (function(d, s) {
           var j, e = d.getElementsByTagName(s)[0];
    
           if (typeof LivereTower === 'function') { return; }
    
           j = d.createElement(s);
           j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
           j.async = true;
    
           e.parentNode.insertBefore(j, e);
       })(document, 'script');
    </script>
    <noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
    <!-- 来必力City版 公共JS代码 end -->



<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>
<!-- anchor-js, Doc:http://bryanbraun.github.io/anchorjs/ -->
<script>
    async("https://cdn.bootcss.com/anchor-js/1.1.1/anchor.min.js",function(){
        anchors.options = {
          visible: 'hover',
          placement: 'left',
          icon: 'ℬ'
        };
        anchors.add().remove('.intro-header h1').remove('.subheading').remove('.sidebar-container h5');
    })
</script>
<style>
    /* place left on bigger screen */
    @media all and (min-width: 800px) {
        .anchorjs-link{
            position: absolute;
            left: -0.75em;
            font-size: 1.1em;
            margin-top : -0.1em;
        }
    }
</style>


<!-- 复制添加版权申明-->
<script>
    /**/
    function setClipboardText(event){
        event.preventDefault();//阻止元素发生默认的行为（例如，当点击提交按钮时阻止对表单的提交）。
        var node = document.createElement('div');
        //对documentfragment不熟，不知道怎么获取里面的内容，用了一个比较笨的方式
        node.appendChild(window.getSelection().getRangeAt(0).cloneContents());
        //getRangeAt(0)返回对基于零的数字索引与传递参数匹配的选择对象中的范围的引用。对于连续选择，参数应为零。
        var htmlData = '<div>'
            + node.innerHTML
            + '<br /><br />著作权归作者所有。<br />'
            + '商业转载请联系作者获得授权，非商业转载请注明出处。<br />'
            + '作者：hanyajun <br />链接：'
            + location.href
            + '<br />来源：hanyajun.com<br /><br />'
            + '</div>';
        var textData = window.getSelection().getRangeAt(0)
            + '\n\n著作权归作者所有。\n'
            + '商业转载请联系作者获得授权，非商业转载请注明出处。\n'
            + '作者：hanyajun\n'
            + '链接：'
            + location.href
            + '来源：hanyajun.com\n\n';
        if(event.clipboardData){
            event.clipboardData.setData("text/html", htmlData);
            //setData(剪贴板格式, 数据) 给剪贴板赋予指定格式的数据。返回 true 表示操作成功。
            event.clipboardData.setData("text/plain",textData);
        }
        else if(window.clipboardData){ //window.clipboardData的作用是在页面上将需要的东西复制到剪贴板上，提供了对于预定义的剪贴板格式的访问，以便在编辑操作中使用。
            return window.clipboardData.setData("text", textData);
        }
    };
 
    document.addEventListener('copy',function(e){
        setClipboardText(e);
    });
</script>

<!-- chrome Firefox 中文锚点定位失效-->
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<!-- smooth scroll behavior polyfill  -->
<script type="text/javascript" src="/js/smoothscroll.js"></script>
<script>
        $('#toc').on('click','a',function(a){
            // var isChrome = window.navigator.userAgent.indexOf("Chrome") !== -1;
            // console.log(window.navigator.userAgent,isChrome)
                // if(isChrome) {
                    // console.log(a.currentTarget.outerHTML);
                    // console.log($(a.currentTarget).attr("href"));
                    //跳转到指定锚点
                    // document.getElementById(a.target.innerText.toLowerCase()).scrollIntoView(true);
                    document.getElementById($(a.currentTarget).attr("href").replace("#","")).scrollIntoView({behavior: 'smooth' });
                // }
        })  
</script>




<!-- disqus embedded js code start (one page only need to embed once) -->
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>
<!-- disqus embedded js code start end -->


    <!-- Footer -->
    <!-- Footer -->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                
                    <li>
                        <a href="/atom.xml" title="RSS">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-rss fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                
                
                

                

                

                
                    <li>
                        <a target="_blank"  href="https://github.com/Han-Ya-Jun" title="github">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                
                
                
                    <li>
                        <a target="_blank"  href="https://blog.csdn.net/hanyajun0123" title="CSDN">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-csdn fa-stack-1x fa-inverse">C</i>
                            </span>
                        </a>
                    </li>
                
                
                
                    <li>
                        <a target="_blank"  href="https://yq.aliyun.com/u/hanyajun" title="云栖社区">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-csdn fa-stack-1x fa-inverse">云</i>
                            </span>
                        </a>
                    </li>
                
                
                
                    <li>
                        <a target="_blank"  href="https://juejin.im/user/5abc76cf6fb9a028bf05642e" title="掘金">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-csdn fa-stack-1x fa-inverse">掘</i>
                            </span>
                        </a>
                    </li>
                
                
                
                    <li>
                        <a target="_blank"  href=" mailto:hanyajun0123@163.com" title="mail">
                            <span class="fa-stack fa-lg">
                               <i class="fa fa-circle fa-stack-2x"></i>
                               <i class="fa fa-envelope-o fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                

                

                </ul>
                <p class="copyright text-muted">
                    Copyright &copy; 韩亚军 2019 
                    <br>
                    Theme by <a href="http://www.huweihuang.com">胡伟煌</a> 
                    <span style="display: inline-block; margin: 0 5px;">
                        <i class="fa fa-heart"></i>
                    </span> 
                    re-Ported by <a href="http://www.hanyajun.com">韩亚军</a> | 
                    <iframe
                        style="margin-left: 2px; margin-bottom:-5px;"
                        frameborder="0" scrolling="0" width="91px" height="20px"
                        src="https://ghbtns.com/github-btn.html?user=Han-Ya-Jun&repo=hexo-theme-hanyajun&type=star&count=true" >
                    </iframe>
                    <br />
                    <!--总访问量统计-->
                    
                        <span>
                        <a target="_blank" href="http://www.beianbeian.com/beianxinxi/7625ff811d2421a06b38a23c0a085037.html"><img src="/img/upload/beian.png">粤ICP备17133239号-1</a>
                        </span>
                        <span id="busuanzi_container_site_pv" style="margin-left: 3px;">
                            总访问量<span id="busuanzi_value_site_pv"></span>次
                        </span>
                    
                    <!--总访问量统计-->
                </p>
            </div>
        </div>
    </div>
</footer>

<!-- jQuery -->
<script src="/js/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="/js/bootstrap.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="/js/hux-blog.min.js"></script>


<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>

<!-- 
     Because of the native support for backtick-style fenced code blocks 
     right within the Markdown is landed in Github Pages, 
     From V1.6, There is no need for Highlight.js, 
     so Huxblog drops it officially.

     - https://github.com/blog/2100-github-pages-now-faster-and-simpler-with-jekyll-3-0  
     - https://help.github.com/articles/creating-and-highlighting-code-blocks/    
-->
<!--
    <script>
        async("http://cdn.bootcss.com/highlight.js/8.6/highlight.min.js", function(){
            hljs.initHighlightingOnLoad();
        })
    </script>
    <link href="http://cdn.bootcss.com/highlight.js/8.6/styles/github.min.css" rel="stylesheet">
-->


<!-- jquery.tagcloud.js -->
<script>
    // only load tagcloud.js in tag.html
    if($('#tag_cloud').length !== 0){
        async("https://hanyajun.com/js/jquery.tagcloud.js",function(){
            $.fn.tagcloud.defaults = {
                //size: {start: 1, end: 1, unit: 'em'},
                color: {start: '#bbbbee', end: '#0085a1'},
            };
            $('#tag_cloud a').tagcloud();
        })
    }
</script>

<!--fastClick.js -->
<script>
    async("https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js", function(){
        var $nav = document.querySelector("nav");
        if($nav) FastClick.attach($nav);
    })
</script>


<!-- Google Analytics -->


<script>
    // dynamic User by Hux
    var _gaId = 'UA-138985430-1';
    var _gaDomain = 'hanyajun.com';

    // Originial
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', _gaId, _gaDomain);
    ga('send', 'pageview');
</script>




<!-- Baidu Tongji -->

<script>
    // dynamic User by Hux
    var _baId = 'a79d548adc1c9b6a3d8b8ba1e8d0620c';

    // Originial
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?" + _baId;
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
</script>






	<a id="rocket" href="#top" class=""></a>
	<script type="text/javascript" src="/js/totop.js?v=1.0.0" async=""></script>
    <script type="text/javascript" src="/js/toc.js?v=1.0.0" async=""></script>
<!-- Image to hack wechat -->
<img src="https://hanyajun.com/img/icon_wechat.png" width="0" height="0" />
<!-- Migrate from head to bottom, no longer block render and still work -->

</body>

</html>
